<html lang="zh"><head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title>新增请假申请</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/font-awesome.min.css" rel="stylesheet">
    <!-- bootstrap-table 表格插件样式 -->
    <link href="/ajax/libs/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css" rel="stylesheet">
    <link href="/feitian/css/ry-ui.css" rel="stylesheet">


    <link href="/ajax/libs/datapicker/bootstrap-datetimepicker.min.css" rel="stylesheet">

    <link rel="stylesheet" href="/ajax/libs/layer/theme/default/layer.css?v=3.1.1" id="layuicss-layer"><link rel="stylesheet" href="/ajax/libs/layer/theme/moon/style.css" id="layuicss-thememoonstylecss"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-leave-add" novalidate="novalidate">
        <div class="form-group">
            <label class="col-sm-3 control-label">用户id：</label>
            <div class="col-sm-8">
                <input name="userId" class="form-control" type="text" aria-required="true">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">打卡类型:</label>
            <div class="col-sm-8">
                <div class="col-sm-8">
                    <select name="cardType" class="form-control m-b">
                        <option value="1">上班卡</option>
                        <option value="2">下班卡</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
            <label class="col-sm-3 control-label">ip地址：</label>
            <div class="col-sm-8">
                <input name="ip" class="form-control" type="text" aria-required="true">
            </div>
        </div>
          <!--  <div class="form-group">
                <label class="col-sm-3 control-label">ip地址：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="ip" class="form-control"  type="text" required="" aria-required="true">
                    </div>
                </div>
            </div>-->
            <div class="form-group">
                <label class="col-sm-3 control-label">打卡时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="createTime" class="form-control" placeholder="yyyy-MM-dd" type="text" required="" aria-required="true">
                    </div>
                </div>
            </div>
           <!-- <div class="form-group">
                <label class="col-sm-3 control-label">批准状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box">
                        <select name="status">
                            <option value="">所有</option>
                            <option value="1">待审批</option>
                            <option value="2">已批准</option>
                            <option value="3">已取消</option>
                        </select>
                    </div>
                </div>
            </div>-->
            <div class="layui-layer-btn layui-layer-btn-">
                <a class="layui-layer-btn0" id="save">确定</a>
                <a class="layui-layer-btn1" id="back">关闭</a>
            </div>
        </div>
    </form>

    <script src="/js/jquery.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <!-- bootstrap-table 表格插件 -->
    <!--    <script src="/ajax/libs/bootstrap-table/bootstrap-table.min.js"></script>-->
    <!--    <script src="/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>-->
    <!--    <script src="/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js"></script>-->
    <!--    <script src="/ajax/libs/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.min.js"></script>-->
    <!--    <script src="/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js"></script>-->
    <!-- jquery-validate 表单验证插件 -->
    <!--    <script src="/ajax/libs/validate/jquery.validate.min.js"></script>-->
    <!--    <script src="/ajax/libs/validate/messages_zh.min.js"></script>-->
    <!--    <script src="/ajax/libs/validate/jquery.validate.extend.js"></script>-->
    <!-- jquery-validate 表单树插件 -->
    <!--    <script src="/ajax/libs/bootstrap-treetable/bootstrap-treetable.js"></script>-->
    <!-- jquery-export 表格导出插件 -->
    <!--    <script src="/ajax/libs/bootstrap-table/extensions/export/bootstrap-table-export.js"></script>-->
    <!--    <script src="/ajax/libs/bootstrap-table/extensions/export/tableExport.js"></script>-->
    <!-- 遮罩层 -->
    <!--    <script src="/ajax/libs/blockUI/jquery.blockUI.js"></script>-->
    <!--    <script src="/ajax/libs/iCheck/icheck.min.js"></script>-->
    <!--    <script src="/ajax/libs/layer/layer.min.js"></script>-->
    <!--    <script src="/ajax/libs/layui/layui.js"></script>-->
    <!--    <script src="/feitian/js/common.js?v=4.1.0"></script>-->
    <!--    <script src="/feitian/js/ry-ui.js?v=4.1.0"></script>-->
    <script src="/ajax/libs//datapicker/bootstrap-datetimepicker.min.js"></script>
<script>
    $(function(){
        addovertime();
    })
    function addovertime(){
        $("#save").click(function(){
            var flag=true;
            var userId=$("#form-leave-add [name=userId]").val();
            $.ajax({
                url:"/getuserbyid",
                data:{
                    id:userId,
                },
                async:false,
                success:function(data){
                    if (data.userId!=userId){
                        alert("该用户不存在")
                        flag=false;
                    }
                }
            })
            if (flag){
                $.ajax({
                    url:"/system/attend/doadd",
                    data:$("#form-leave-add").serialize(),
                    success:function(data){
                        if (data>0){
                            alert("添加成功")
                            location.href="/system/attend"
                        }
                    }
                })
            }
        })
        $("#back").click(function (){
            location.href="/system/attend"
        })
    }

</script>
    <script type="text/javascript">
     $("input[name=createTime]").datetimepicker({
         format:"yyyy-mm-dd",
         minView:"month",
         autoclose:true
     });
    </script>

</div>

</body>
</html>